Passing an array of data to a private function in CodeIgniter/PHP? [facepalm]

Posted by Jack Webb-Heller on Stack Overflow See other posts from Stack Overflow or by Jack Webb-Heller
Published on 2010-06-15T12:07:30Z Indexed on 2010/06/15 12:12 UTC
Read the original article Hit count: 243

So I thought this should be easy, but, I'm n00bing out here and failing epicly (as they say on teh interwebz).

So here's my code:

function xy() {
  $array['var1'] = x;
  $array['var2'] = y;
  echo $this->_z;
}

function _z($array) {
  $xy = $x.$y;
  return $xy;
}

So, why doesn't that seemingly simple code work? I know with views you can pass arrays and the variables are accessible in the views with just their array title, but, why doesn't it work in this case?

Jack

© Stack Overflow or respective owner

Related posts about php

Related posts about codeigniter